import { Schema } from '@formily/vue'

export default {
  install: () => {
    // 注册组件全局默认属性
    Schema.registerPatches((field) => {
      if (field['x-component-props']) {
        field['x-component-props'].placeholder = '请输入'
      }

      // 为所有使用FormItem装饰器的字段设置labelWidth为200
      if (field['x-decorator'] === 'FormItem') {
        if (field['x-decorator-props'] === undefined) {
          field['x-decorator-props'] = {}
        }
      }

      return field
    })
  }
}
